/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {number}
 */
 var getMinimumDifference = function(root) {
    let res = []
    const traversal = function(root){
      if(root === null) return
      traversal(root.left)
      res.push(root.val)
      traversal(root.right)
    }
    let minDec = Infinity
    for(let i = 0;i < res.length - 1;i++){
      if(res[i] < Infinity){
        minDec = res[i]
      }
    }
    return minDec
};